package glen.mgbean;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import java.util.Locale;

/**
 * Created by Test on 2/20/14.
 */
@ManagedBean(name = "mainMgb")
@SessionScoped
public class MainMgb {
    private String locale;

    public MainMgb() {
        locale = FacesContext.getCurrentInstance().getApplication().getDefaultLocale().getDisplayLanguage();
    }

    public String getLocale() {
        return locale;
    }

    public void setLocale(String locale) {
        this.locale = locale;
    }

    public void changeLanguage() {
        FacesContext.getCurrentInstance().getApplication().setDefaultLocale(new Locale(locale));
    }
}
